<html><head>
<meta charset="utf-8">
<meta content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=no" id="viewport" name="viewport">
<meta name="wap-font-scale" content="no">
<meta name="renderer" content="webkit">
<meta http-equiv="Cache-Control" content="no-siteapp">
<meta content="yes" name="apple-mobile-web-app-capable">
<meta content="black" name="apple-mobile-web-app-status-bar-style">
<title>新芽阅读个人中心</title>
<link rel="shortcut icon" href="javascript:void(0)http://img2.2345.com/bookimg/public/pic/book/book_icon.png">
<link rel="stylesheet" href="/static/css/mobile-global.css">
	<link rel="stylesheet" href="/static/css/mobile-user.css">
	<link href="javascript:void(0)http://img1.2345.com/bookimg/public/pic/book/icon-57.jpg" rel="apple-touch-icon">
<link href="javascript:void(0)http://img2.2345.com/bookimg/public/pic/book/icon-114.jpg" sizes="114x114" rel="apple-touch-icon">
<link href="javascript:void(0)http://img3.2345.com/bookimg/public/pic/book/icon-57.jpg" rel="apple-touch-icon-precomposed">
{css href="/static/layout/css/style.css" }
{css href="/static/layout/css/style-responsive.css" }
{css href="/static/css/toastr.min.css"}
{css href="/static/css/details.css"}
 <link rel="stylesheet" href="/static/css/buycar.css">
<style>
	/*.content{width:461px;height:400px;background-color:white;border:1px solid pink;margin-left:-14px;}
	.book{width:432px;margin-top:25px;margin-left:65px;}
	.book img{float:left;}
	.book span:nth-child(2){float:left;margin-left:10px;}
	.book span:nth-child(3){float:left;margin-left:-123px;margin-top:30px;}
	.book span:nth-child(4){float:left;margin-top:65px;}*/
	.uc-info{width:461px;height:90.84px;margin-top:-14px;margin-left:-14px;}
	#home{margin-left:-14px;}
	.mod{margin-top:99px;margin-left:-123px;}
	.buycar{width:1090px;margin:0 auto;margin-top:20px;position:relative;}
     #chese{background-color:red;display:inline-block;width:100px;height:30px;color:white;font-size:14px;border-radius:10px;text-align:center;line-height:30px;margin-top:-40px;margin-left:178px;}
</style>
</head>
<body id="xtopjsinfo" ontouchstart="" style="background-color:#F5F5F5;">
<!--wrapper begin-->
<div class="wrapper userCenter">
<!-- header begin -->
<header class="header inner-header" style="top:-14px;width:461px;height:63.23px;left:-14px;">
<h1 class="sub-title" style="margin-top:0px;font-size:24px;
    color:black;">用户中心</h1>
<a href="{:url('mobile/index/index')}" class="home iconfont icon-home" onclick="cc('ck_m_fanhuishouye')" style="color:black;font-size:24px;"></a></header>
<!--header end--><div class="container" style="padding-left:0px;">
<!-- user -->
<div class="uc-info">
	<div class="avatar"><img src="{$data.icon}" width="60px" height="60px"></div>
	<p >{$data.name}</p>
	<p class="balance">账号：<b class="spec">{$data.tel}</b></p>
<a class="btn-primary" btn-size="small" href="{:url('mobile/Personal/icon',['id'=>$Request.session.user.id])}">更换头像</a></div>
<ul class="uc-op-list" id="home">
	<li><a href="{:url('mobile/Personal/index')}" >返回上一级</a></li>
</ul>
<div class="buycar" style="width:464px;margin-left:-16px;margin-top:10px;">
        <div class="top" style="width:464px;">
           <span style="left:30px;">电子书信息</span>
           <span style="left:248px;">电子书价格(元)</span>
           <span style="right:-45px;">操作</span>
        </div>
        {if empty($list)}
        <div style="width:463px;height:302px;border:1px solid #999;margin:0 auto;margin-top:20px;border:none;">
          <img src="/static/images/details/buycar.png" width="463px" height="300px">
          <a href="{:url('mobile/index/index')}" id="chese">前去挑选图书</a>
        </div>
        {else/}
        {foreach $list as $vo}
        <div class="middle" style="background-color:white;width:464px;margin-top:10px;">
          <label><input type="checkbox" class="check" data-id="{$vo.id}" style="border:1px solid #999;"></label>
          <a href="{:url('moblie/Details/read',['id'=>$vo.did])}"><img src="{$vo.face}" alt="{$vo.name}" style="width:50px;"></a>
          <a href="{:url('mobile/Details/read',['id'=>$vo.did])}"><span class="name" style="top:35px;left:110px;">{$vo.name}</span></a>
          <span class="author" style="top:55px;left:110px;">作者：{$vo.author}</span>
          <span class="price" data-id="{$vo.id}" style="left:280px;top:50px;">{$vo.pay_money}</span>
          <button class="delete" data-id="{$vo.id}" style="right:50px;color:red;background-color:white;border:none;">删除</button>
        </div>
        {/foreach}
        {/if}
        <div class="bottom" style="background-color:white;;width:464px;">
          <span class="choice">全选</span>
          <span class="cancel">取消全选</span>
          <span class="deletebook">删除选中图书</span>
          <span class="choicebook">已选<b class="many">0</b>本电子书</span>
          <div class="rightcount" style="background-color:white;;width:464px;">
            <span class="count" style="font-size:14px;margin-top:20px;margin-left:175px;">合计：&yen;<b class="money">0.00</b></span>
              <button type="button" class="btn btn-primary" data-toggle="modal"  data-target=".bs-example-modal-sm" style="width:70px;height:30px;text-align:center;line-height:10px;font-size:14px;right:98px;top:14px;">去支付</button>
          </div>
        </div>

    </div>
 <!-- Modal -->
        <div class="modal fade bs-example-modal-sm" tabindex="-1" role="dialog" aria-labelledby="mySmallModalLabel" aria-hidden="true" style="left:19px;">
        <div class="modal-dialog modal-sm" style="margin-right:415px;">
            <div class="modal-content"style="width:400px;">
              <div class="modal-header" style="background-color:#FAFAF7;">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                <h4 class="modal-title" id="myModalLabel" style="color:#333">购买图书</h4>
                <h5 class="modal-title" id="myModalLabel" style="float:right;color:#333;margin-top:-25px;margin-right:20px;">账号：<span style="color:#58bd5a;display:inline-block;">{$Request.session.user.name}</span></h5>

              </div>
              <div class="modal-body">
                 <div class="countnumber">图书共：<span style="color:#333;" class="allbook">0</span>本</div>
                <div class="countnumber">图书总额：<span style="color:#333;" class="result">0.00</span>元</div>
                <div class="countnumber">应付金额：<span style="font-size:20px;color:#f60;" class="result">0.00</span>元</div>
              </div>
              <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                    <button class="btn btn-primary gotopay">立即支付</button>
              </div>
            </div>
          </div>
        </div>
     <!-- Modal -->
<ul class="uc-op-list" style="margin-left:-14px;margin-top:15px;">
		<li><a href="{:url('mobile/Personal/logout')}">退出登录</a></li>
</ul>
</div>
</div>
<!--wrapper end-->
<!--footer begin-->
<!--footer begin-->
<footer class="footer" style="height:92px;font-size:18px;">
<p class="links"><a href="{:url('mobile/index/index')}">小说首页</a><i>|</i><a href="javascript:void(0)/app/Personal.html">手机客户端</a><i>|</i><a href="javascript:void(0)/m/Personal.php/c/feedback/">问题反馈</a><i>|</i><a href="javascript:void(0)#xtopjsinfo" class="go_top">返回顶部</a></p>
</footer>
<!--footer end-->
{js href="/static/layout/js/jquery-1.10.2.min.js" }
{js href="/static/layout/js/jquery-ui-1.9.2.custom.min.js" }
{js href="/static/layout/js/jquery-migrate-1.2.1.min.js" }
{js href="/static/layout/js/bootstrap.min.js" }
{js href="/static/layout/js/modernizr.min.js" }
{js href="/static/layout/js/jquery.nicescroll.js" }
{js href="/static/js/toastr.min.js"}

<!--common scripts for all pages-->
{js href="/static/layout/js/scripts.js"}
<script>
	$(function () {
        // 设置弹框参数
        toastr.options = {
            closeButton: true,// 是否显示关闭按钮
            progressBar: true,// 实现显示计时条
            timeOut: "3000",  // 自动关闭时间
            positionClass: "toast-top-right" // 提示位置
            // toast-top-full-width 顶端，宽度铺满整个屏幕
            // toast-top-right  顶端右边
        };

        $('.btn-primary').click(function(){
            var checkedNum = $("input[class='check']:checked").length;
             if(checkedNum == 0) { 
                $(this).removeAttr('data-toggle');
                toastr.error("请选择你的图书！", 'FBI WARING:'); 
             }else{
              $(this).attr("data-toggle","modal");
             }
        });

        // 触发删除订单
        $('.delete').click(function () {
            var oid = $(this).attr('data-id');
            if (confirm('你确定要[删除]吗?!')) {
                var obj = $(this).parent('div');
                DeleteOrder(oid,obj); // 指定删除信息操作
            }
            
        });
        
        //删除选中的
        $('.deletebook').click(function () {
           var checkedNum = $("input[class='check']:checked").length;
           if(checkedNum == 0) { 
                    toastr.error("请选择至少一项！", 'FBI WARING:'); 
                    return; 
               } 
         // 批量选择 
         if(confirm("确定要删除所选项目？")) { 
         var checkedList = [];
         var divList = new Array(); 
         $("input[class='check']:checked").each(function() { 
            checkedList.push($(this).attr('data-id'));
            divList.push($(this).parents('.middle'));
         });
         DeleteSelect(checkedList,divList);
       }
     });
            

        var num = 0;
        var nid = [];
        $('.check').click(function () { 
            if($(this).is(":checked") == false){
              $(this).parents('.middle').css({backgroundColor:'white'});
              var checkedNum = $("input[class='check']:checked").length;
              $('.many').html(checkedNum);
              $('.money').html(parseFloat(0));
              $('.allbook').html(checkedNum);
              num -= parseFloat($(this).parent('label').nextAll('.price').html());
              $('.money').html(num.toFixed(2));
              $('.result').html(num.toFixed(2));
              nid.splice(0,nid.length)
            }else{
              $(this).parents('.middle').css({backgroundColor:'#FFFAF0'});
              var checkedNum = $("input[class='check']:checked").length;
              $('.many').html(checkedNum);
              $('.allbook').html(checkedNum);
              num += parseFloat($(this).parent('label').nextAll('.price').html());
              $('.money').html(num.toFixed(2));
              $('.result').html(num.toFixed(2));
            }
            
            $("input[class='check']:checked").each(function() { 
              nid.push($(this).attr('data-id'));
              });
            $('.gotopay').click(function(){
             gotopay(nid); 
           });

            
        });

        $('.choice').click(function(){
           num = 0;
           $(".check").each(function () {
                    $(this).prop('checked',true);
                    $(this).parents('.middle').css({backgroundColor:'#FFFAF0'});
                    var checkedNum = $("input[class='check']:checked").length;
                    $('.many').html(checkedNum);
                    $('.allbook').html(checkedNum);
                    num += parseFloat($(this).parent('label').nextAll('.price').html());
                    $('.money').html(num.toFixed(2));
                    $('.result').html(num.toFixed(2));
              });

            $("input[class='check']:checked").each(function() { 
              nid.push($(this).attr('data-id'));
              });
            $('.gotopay').click(function(){
             gotopay(nid); 
           });
            

        });

      $('.cancel').click(function(){
        $(".check").each(function () {
        $(this).prop('checked',false);
        $(this).parents('.middle').css({backgroundColor:'white'});
        $('.many').html(0);
        $('.allbook').html(0);
        num = 0;
        $('.money').html(num.toFixed(2));
        $('.result').html(num.toFixed(2));
      });

          $("input[class='check']:checked").each(function() { 
            nid.push($(this).attr('data-id'));
            });
          $('.gotopay').click(function(){
             gotopay(nid); 
            });

      });
      
    });//总括号

    function DeleteOrder(oid,obj) {
        $.ajax({
            type: 'delete',
            url: '/buycar/'+oid,
            dataType:'json',
            success: function (data) {
                if (data.status) {
                    toastr.success(data.info);
                    // 将该条目删除掉
                    obj.remove();
                } else {
                    toastr.error(data.info, 'FBI WARING:');
                }
            },
            error: function () {
                alert('AJAX操作失败');
            }
        });
    }
    

    //删除选中的
    function DeleteSelect(aid,obj) {
        $.ajax({ 
                  data: {'id':aid},
                  type: "POST",  
                  url: "/deletemore.html",
                  dataType:'json',  
                  success: function(result) { 
                    if (result.status) {
                    toastr.success(result.info);
                    // 将该条目删除掉
                    window.location.reload();
                        } else {
                     toastr.error(result.info, 'FBI WARING:');
                     }
                  },
                  error: function () {
                     alert('AJAX操作失败');
                   } 
               }); 
      }


      function gotopay(nid) {
        $.ajax({ 
                  data: {'id':nid},
                  type: "POST",  
                  url: "/gopay.html",
                  dataType:'json',  
                  success: function(result) { 
                    if (result.status) {
                    toastr.success(result.info);
                    window.location.reload();
                        } else {
                     toastr.error(result.info, 'FBI WARING:');
                     }
                  },
                  error: function () {
                    
                   } 
               }); 
      }






</script>
</body>
</html>